package com.blockchainenergy.common;

import com.blockchainenergy.blockChain.BlockChainService;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Arrays;

// 用于项目启动时运行方法
@Component
@Order(value = 1)
public class AfterRunner implements ApplicationRunner {
    @Resource
    private BlockChainService blockChainService;
    public static final String SAMPLE_XLSX_FILE_PATH = "src/main/resources/demo.xlsx";

    @Override
    public void run(ApplicationArguments args) throws Exception {
        System.out.println("执行方法");
        int[][] matrix = ExcelReader.copyData(SAMPLE_XLSX_FILE_PATH);
        for (int i = 0; i < 8; i++) blockChainService.matrixToBlock(matrix);
    }
}
